No Copy or Assign for IO Objects
Functions that do IO typically pass and return the stream through references. Reading or writing an IO object changes its state, so the reference must not be const.
The library lets us ignore the differences among these different kinds of streams by using inheritance
There are two other similar manipulators: flush and ends.
flush flushes the stream but adds no characters to the output; ends inserts a null character into the buffer and then flushes it
Output buffers are not flushed if the program terminates abnormally.
Tying Input and Output Streams Together:
When an input stream is tied to an output stream, any attempt to read the input stream will first flush the buffer associated with the output stream.
To tie a given stream to a new output stream, we pass tie a pointer to the new stream. To untie the stream completely, we pass a null pointer. Each stream can be tied to at most one stream at a time. However, multiple streams can tie themselves to the same ostream
The only way to preserve the existing data in a file opened by an ofstream
is to specify app or in mode explicitly.
File Mode Is Determined Each Time open Is Called.